package mysql

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Username string `gorm:"type:varchar(30);not null;comment:'账号'"`
	Password string `gorm:"type:varchar(255);not null;comment:'密码'"`
}

func (u *User) UserByUsername(db *gorm.DB, name string) error {
	return db.Debug().Where("Username", name).First(u).Error
}

func (u *User) Register(db *gorm.DB) error {
	return db.Debug().Create(&u).Error
}
